<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="refresh" content="5">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
table, td, th{	border:0px solid black; }
th{	background-color:skyblue; color:white; font-size:14px; }
td{	background-color:gainsboro ;font-size:16px; text-align:center;}
</style>
<script type="text/javascript" src="./jquery-1.7.2.js"></script>
<script type="text/javascript">
	 $(document).ready(function() {
		 
		$.ajax({
			type : "POST",
			url : "factory.do",
			data : "command=getOperationInfo",
			dataType : "json", // json으로 datatype을 명시 
			success : function(jsonData) {
				var table="<table border='1'>"+
				"<tr>"+
				"	<td colspan='3'>제 1 공정"+
				"		<table border='1'>"+
				"			<tr>"+
				"				<th>제품 번호</th>"+
				"				<th>lot 번호</th>"+
				"				<th>성공/실패</th>"+
				"				<th>공정 시작 시간 </th>"+
				"				<th>공정 끝 시간</th>"+
				"			</tr>";
				for(var i=0; i<jsonData.opMap.op1.length;i++){
				 table += "<tr><td>"+jsonData.opMap.op1[i].op_id+"</td><td>"+jsonData.opMap.op1[i].lot_id+"</td><td>"+jsonData.opMap.op1[i].op_flag+"</td><td>"+jsonData.opMap.op1[i].op_start+"</td><td>"+jsonData.opMap.op1[i].op_end+"</td></tr>";
				}//for
				table +="</table>"+
				"	</td>"+ 
				"	<td colspan='3'>제 2 공정"+
				"		<table border='1'>"+
				"			<tr>"+
				"				<th>제품 번호</th>"+
				"				<th>lot 번호</th>"+
				"				<th>성공/실패</th>"+
				"				<th>공정 시작 시간 </th>"+
				"				<th>공정 끝 시간</th>"+
				"			</tr>";
				for(var i=0; i<jsonData.opMap.op2.length;i++){
				 table += "<tr><td>"+jsonData.opMap.op2[i].op_id+"</td><td>"+jsonData.opMap.op2[i].lot_id+"</td><td>"+jsonData.opMap.op2[i].op_flag+"</td><td>"+jsonData.opMap.op2[i].op_start+"</td><td>"+jsonData.opMap.op2[i].op_end+"</td></tr>";
				} //for 
				table+="</table>"+
				"	</td>"+
				"	<td colspan='3'>제 3 공정"+
				"		<table border='1'>"+
				"			<tr>"+
				"				<th>제품 번호</th>"+
				"				<th>lot 번호</th>"+
				"				<th>성공/실패</th>"+
				"				<th>공정 시작 시간 </th>"+
				"				<th>공정 끝 시간</th>"+
				"			</tr>";
				for(var i=0; i<jsonData.opMap.op3.length;i++){
				 table += "<tr><td>"+jsonData.opMap.op3[i].op_id+"</td><td>"+jsonData.opMap.op3[i].lot_id+"</td><td>"+jsonData.opMap.op3[i].op_flag+"</td><td>"+jsonData.opMap.op3[i].op_start+"</td><td>"+jsonData.opMap.op3[i].op_end+"</td></tr>";
				} //for 
				$("#op").html(table);
			}//success
		});//ajax
	});
</script>
</head>
<body>
<center>
<img src="/BF_MES/img/bfgif4.gif" style="vertical-align:middle;"><!--  vspace="50" hspace="10"> -->
</center>
<div id="op">
	<table border='1'>
		<tr>
			<td colspan="3">제 1 공정
				<table border="1">
					<tr>
						<th>제품 번호</th>
						<th>lot 번호</th>
						<th>성공/실패</th>
						<th>공정 시작 시간 </th>
						<th>공정 끝 시간</th>
					</tr>
					<c:forEach var="op1" items="${requestScope.opMap.op1}">
						<tr>
							<td>${op1.op_id}</td>
							<td>${op1.lot_id}</td>
							<td>${op1.op_flag}</td>
							<td>${op1.op_start}</td>
							<td>${op1.op_end}</td>
						</tr>
					</c:forEach>
				</table>
			</td>
			<td colspan="3">제 2 공정
				<table border="1">
					<tr>
						<th>제품 번호</th>
						<th>lot 번호</th>
						<th>성공/실패</th>
						<th>공정 시작 시간 </th>
						<th>공정 끝 시간</th>
					</tr>
					<c:forEach var="op2" items="${requestScope.opMap.op2}">
						<tr>
							<td>${op2.op_id}</td>
							<td>${op2.lot_id}</td>
							<td>${op2.op_flag}</td>
							<td>${op2.op_start}</td>
							<td>${op2.op_end}</td>
						</tr>
					</c:forEach>
				</table>
			</td>
			<td colspan="3">제 3 공정
				<table border="1">
					<tr>
						<th>제품 번호</th>
						<th>lot 번호</th>
						<th>성공/실패</th>
						<th>공정 시작 시간 </th>
						<th>공정 끝 시간</th>
					</tr>
					<c:forEach var="op3" items="${requestScope.opMap.op3}">
						<tr>
							<td>${op3.op_id}</td>
							<td>${op3.lot_id}</td>
							<td>${op3.op_flag}</td>
							<td>${op3.op_start}</td>
							<td>${op3.op_end}</td>
						</tr>
					</c:forEach>
				</table>
			</td>
		</tr>
	</table>
</div>
</body>
</html>